import jsCookie from 'js-cookie'
import Cookie from 'cookie'

// 设置cookie
export const setCookie = (key, value, time) => {
  return jsCookie.set(key, value, { expires: time })
}

// 获取cookie
export const getCookie = key => {
  return jsCookie.get(key)
}

// 清除cookie
export const removeCookie = key => {
  return jsCookie.remove(key)
}

// cookie格式化
export const parseCookie = cookieStr => {
  return Cookie.parse(cookieStr || '') || {}
}
